﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using System.Data.SQLite;

namespace WindowsFormsApplication1
{
    public partial class Form6 : Form
    {
        public Form6()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            
            string cid = textBox1.Text.ToString();
            string ssql = "select count(*) from test_borrow where cid=@cid and tag='借出'";
            string conString = ConfigurationManager.ConnectionStrings["myconn"].ConnectionString;
            SQLiteConnection conn = new SQLiteConnection(conString);
            conn.Open();
            SQLiteCommand cmd = new SQLiteCommand(ssql, conn);
            cmd.Parameters.AddWithValue("@cid", cid);
            int i = Convert.ToInt32(cmd.ExecuteScalar());
            label2.Text = "该借书证已经借过" + i.ToString() + "本书";


        }
    }
}
